package eyer.utils;

import java.util.Map;

import eyer.jmx.JmxClient;
import eyer.jmx.JmxClientException;

public class JMXClientTest {

    public static void main(String[] args) throws InterruptedException {
        String host = IPUtils.getLocalHostName();
        JmxClient client = JmxClient.getInstance();
        try {
            client.addConnector(host, 8989, "QED");

            for (int i = 0; i < 100; i++) {
                Map<String, Object> r = client.getAttrs(host, JMXUtils.PRE + "JVMMemory");
                System.out.println(r);

                Thread.currentThread();
                Thread.sleep(1000);
            }
        } catch (JmxClientException e) {
            e.printStackTrace();
        } finally {
            client.disconnect();
        }
    }

}
